#!/usr/bin/env python

import unittest
from snapshot import Snapshot
import util

class TestSnapshot(Snapshot, unittest.TestCase):
  def __init__(self, *args, **kwargs):
    unittest.TestCase.__init__(self, *args, **kwargs)
    Snapshot.__init__(self)

  def setUp(self):
    #print "setUp"
    pass

  def tearDown(self):
    #print "tearDown"
    pass

  def test_createSnapshot(self):
    volumeid = 16
    response = self.createSnapshot(volumeid)
    self.assertEqual(response["volumeid"], volumeid)

  def test_listSnapshots(self):
    response = self.listSnapshots()
    self.assertTrue(len(response) == 0 or response["count"]>0)

  def test_deleteSnapshot(self):
    snapshotid = 1
    response = self.deleteSnapshot(snapshotid)
    self.assertEqual(response["success"], True)

def get_suite():
  suite = unittest.TestSuite()
  #suite.addTest(TestSnapshot("test_createSnapshot"))
  #suite.addTest(TestSnapshot("test_listSnapshots"))
  suite.addTest(TestSnapshot("test_deleteSnapshot"))
  return suite

if __name__ == "__main__":
  suite = get_suite()
  runner = unittest.TextTestRunner()
  runner.run(suite)
